<template>
  <div>
    <div style="background: #e8f1f8">
      <div class="det_tab">
        <div class="det_tab_item">
          <eagle-cell-group :border="border">
            <eagle-input label="计划名称" :value="form.PlanName" readonly></eagle-input>
            <eagle-input label="考核" :value="form.IsCheck ? '是' : '否'" readonly></eagle-input>
            <eagle-input 
              v-if="form.IsCheck" 
              label="考核类型" :value="
                form.PlanName == 1
                  ? '理论'
                  : form.PlanName == 2
                  ? '实践'
                  : '理论+实践'
              " readonly>
            </eagle-input>
            <eagle-input v-if="form.IsCheck" label="考核人" :value="form.CheckChnName" readonly></eagle-input>
            <eagle-input label="培训说明" autosize type="textarea" rows="1" :value="form.Introduce" readonly></eagle-input>
            <eagle-input label="开始时间" :value="form.PlanStartTime" readonly></eagle-input>
            <eagle-input label="结束时间" :value="form.PlanFinishTime" readonly></eagle-input>
            <eagle-input label="学习内容" :value="'已选' + totalCourse + '个课件'" readonly islink @click="goPlanCourse()"></eagle-input>
            <eagle-input label="学习人员" :value="'已选' + total + '人'" readonly islink @click="goPlanPerson()"></eagle-input>
          </eagle-cell-group>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getDate } from "@/utils/getDate";
// import { deepClone } from "@/utils";
export default {
  components: {},
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      id: this.$route.query.id,
      border: false,
      form: {},
      total: 0,
      totalCourse: 0,
    };
  },
  created() {
    this.geDetail();
  },
  activated() {
    // if (this.$route.params.Operator) {
    // 	this.CorrectiveUserName = this.$route.params.Operator
    // 	this.CorrectiveChnName = this.$route.params.OperatorName
    // }
  },
  methods: {
    // 获取详情
    geDetail() {
      let _this = this;
      _this.$axios
      .get("/TrainPlan/GetUnionDetail",{params:{id: _this.id }})
      .then((res) => {
        _this.form = res.data;
        _this.form.PlanStartTime = getDate( res.data.PlanStartTime)
        _this.form.PlanFinishTime = getDate( res.data.PlanFinishTime)
        _this.total = _this.form.Details2.length;
        _this.totalCourse = _this.form.Details.length;
      });
    },
    goPlanCourse() {
      //this.$router.push({name:'PlanCourse',params: {details: this.form.Details}})
      this.$router.push({
        path: "/Train/PlanCourse",
        query: { id: this.id },
      });
    },
    goPlanPerson() {
      //this.$router.push({name:'PlanPerson',params:{details:this.form.Details2}})
      this.$router.push({
        path: "/Train/PlanPerson",
        query: { id: this.id },
      });
    },
  },
};
</script>

<style lang="less">
/*
        .main {
            height: 100vh;
        }
    */

.det_top_box {
  padding: 10px;
  background-color: #e8f1f8;
}

.detail_header {
  color: #ffffff;
  background: url("../../../assets/Images/AppIcon/image_riskunit_detail_bg.png");
  background-size: cover;
  padding: 10px;
  border-radius: 5px;
  /*background-color: #fff;*/

  .det_top {
    display: flex;
    justify-content: space-between;

    .dep_top_img {
      height: 20px;
      width: 20px;
      margin-right: 5px;
    }
  }

  .det_name {
    margin-top: 20px;
    text-align: center;
  }

  .det_location {
    text-align: center;
    margin-bottom: 20px;
  }
}

// .det_tab {
//   padding: 10px;
//   .det_tab_item {
//     padding: 10px 0;
//     background-color: #fff;
//     border-radius: 5px;
//     margin-bottom: 10px;

//     .det_tab_item_text {
//       padding: 0 10px;
//     }
//   }
// }
.text_box {
  padding: 10px;
  border-radius: 5px;
  /*background-color: #e8f1f8;*/
  margin-bottom: 10px;

  .text_top {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .top_link {
      color: #1989fa;
    }
  }

  .text_item {
    display: flex;
    justify-content: space-between;
    margin-left: 10px;

    .item_link {
      color: #1989fa;
    }
  }

  .text_img {
    display: flex;
    align-items: center;

    .img_item {
      width: 33.3%;
      text-align: center;

      img {
        height: 25px;
        width: 25px;
        margin-bottom: 10px;
      }
    }
  }

  .text_history {
    display: flex;
    vertical-align: middle;
    margin-bottom: 10px;
  }

  .text_member {
    color: #1989fa;
    margin-bottom: 10px;
  }

  .text_total_img {
    display: flex;
    align-items: center;

    .img_item {
      width: 33.3%;
      text-align: center;

      .img_item_top {
        display: flex;
        vertical-align: middle;
        margin-bottom: 10px;
      }
      img {
        height: 15px;
        width: 15px;
        margin-right: 5px;
      }
    }
  }
  .text_record_list {
    .list_row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      > div {
        width: 33.3%;
      }
      .row_center {
        text-align: center;
      }
      .row_right {
        text-align: right;
      }
    }
  }
}
.operate_det {
  background-color: #fff;
  padding: 10px;
  .operate_list {
    font-size: 12px;
    border: 1px solid #e8f1f8;
    .operate_row_first {
      padding: 10px;
      background-color: #e8f1f8;
      border-bottom: 1px solid #e8f1f8;
      margin-bottom: 10px;
    }
    .operate_row {
      padding: 10px;
      border-bottom: 1px solid #e8f1f8;
      /*margin-bottom: 10px;*/
    }
  }
}
</style>
